#include <iostream>


int divide(int a,int b)
{
    if(b == 0)
        throw 'a';
    return a / b;
}

int main()
{
    //尝试运行某一段代码
    try
    {
        std::cout<<divide(4,0)<<std::endl;
    }
    //捕获该异常
    catch(int e)
    {
        std::cout<<"捕获int类型异常!"<<std::endl;
    }
    catch(const char *s)
    {
        std::cout<<"捕获字符串类型异常!"<<std::endl;
    }
    catch(double e)
    {
        std::cout<<"捕获double类型异常!"<<std::endl;
    }
    catch(...)
    {
        std::cout<<"捕获到其他异常!"<<std::endl;
    }
    return 0;
}